package cn.edu.cqut.mdm.core.lookup;

import cn.edu.cqut.mdm.container.InvokableModuleContainer;
import cn.edu.cqut.mdm.core.module.ModuleEntity;
import cn.edu.cqut.mdm.core.module.RemoteModuleEntity;
import cn.edu.cqut.mdm.core.publisherdispatcher.LocalPublisherDispatcher;
import cn.edu.cqut.mdm.register.LocalRegister;

public class LocalModuleFinder {
	public void findModules() {
		for(ModuleEntity moduleEntity : LocalRegister.getRegister().getAllModuleMap().values()) {
			RemoteModuleEntity remoteModuleEntity = moduleEntity.toRemoteModuleEntity(new LocalPublisherDispatcher().getName());
			remoteModuleEntity.setPublisherDispatcher(new LocalPublisherDispatcher());
			remoteModuleEntity.setUrl("本地");
			InvokableModuleContainer.getInstance().addRemoteModuleEntity(remoteModuleEntity);
		}
	}
}
